<include file="Public/header"/>
<body class="body-bg">
<div class="park-header">
    <div class="park-header__title">我的评论</div>
    <div class="park-header__left park-back">
        <i class="iconfont icon-fanhui"></i>
    </div>
</div>
<div class="container">
    <div class="park-comment-list" id="comment_list"></div>
</div>
</body>
<script>
    var options = {
        type: 'get', // default 'get'
        dataType: 'html' // default 'json'
    };
    $(function () {
        var url = '/Home/User/comment/';
        var params = {'act': 'ajax'};
        PARK.dropLoad(PARK.dropAjax(options, url, params, function (data) {
            var data = JSON.parse(data);
            var html = '';
            for (var i = 0; i < data.result.length; i++) {
                html+='<div class="park-comment-item">';
                html+='    <div class="park-comment-item__face" style="background-image:url('+data['result'][i]['head_picture']+');background-size:100px;"></div>';
                html+='    <div class="park-comment-item__time">'+data['result'][i]['add_time']+'</div>';
                html+='    <div class="park-comment-item__username">'+data['result'][i]['user_name']+'</div>';
                html+='    <div class="park-comment-item__star">';
                for(var j=0;j<5;j++) {
                    if(data['result'][i]['star']>j) {
                        html += '        <i class="iconfont icon-star active"></i>';
                    }else{
                        html += '        <i class="iconfont icon-star"></i>';
                    }
                }
                html+='    </div>';
                html+='    <div class="park-comment-item__text">'+data['result'][i]['contents']+'</div>';
                html+='</div>';
            }
            if(html){
                $('#comment_list').append(html);
            }else {
                $('#comment_list').append('<div style="text-align:center;padding:50px;color:#ccc;">暂无评论</div>');
            }
            if (data.is_page == 1) {
                PARK.unDropLoad();
            }
        }));
    });
</script>
</html>